package com.exception;

public class Test {
    public static void main(String[] args) {
        int a = 10;
        int b = 0;
//ctrl+alt+t  抓捕异常
        try {//try监控区域
            if (b==0){//throw  throws
                throw new ArithmeticException();//主动的抛出异常
            }
            System.out.println(a/b);
        } catch (Exception e) {//catch（想要捕获的异常类型）捕获异常

            e.printStackTrace();//打印错误的栈信息
        } finally {//处理善后工作
        }
    }

}
